
var WindRadio = new Object();

WindRadio.createView = function() {
	var radio = new WindView();
	radio.setCssClass("WindRadio");
	
	radio.setName = function(name) {
		this.name = name;
	}
	
	radio.getName = function() {
		return this.name;
	}
	
	radio.setValue = function(value) {
		this.value = value;
	}
	
	radio.getValue = function() {
		return this.value;
	}

	radio.render = function() {
		var input = document.createElement("input");
		input.type = "radio";
				
		this.applyViewAttributesToHtmlElement(input);
		
		var name = this.getName();
		if(name!=null) {
			input.name = name;
		}
		
		if(this.value!=null && this.value=="true") {
			input.checked = true;
		}
		
		input.onchange = function() {
			if(input.checked) {
				radio.setValue("true");
			} else {
				radio.setValue("false");
			}
		}	
		
		return input;
	}
	
	return radio;
}